<!--
 * @Author: 谢陈洁
 * @Date: 2025-06-23 13:50:11
 * @LastEditors: 谢陈洁
 * @LastEditTime: 2025-07-14 15:09:18
 * @Description: file content
-->
<!-- filepath: src/components/BaseDrawer/index.vue -->
<template>
  <el-drawer
    v-bind="$attrs"
    :model-value="modelValue"
    @update:modelValue="(val: Boolean) => $emit('update:modelValue', val)"
    :title="title"
    :size="size"
    :close-on-click-modal="closeOnClickModal"
    :destroy-on-close="destroyOnClose"
  >
    <slot />
    <template #footer>
      <slot name="footer" v-if="showFooter">
        <el-button @click="$emit('cancel')">取消</el-button>
        <el-button type="primary" @click="$emit('ok')">确定</el-button>
      </slot>
    </template>
  </el-drawer>
</template>

<script setup lang="ts">
  defineProps({
    modelValue: Boolean,
    title: { type: String, default: '' },
    size: { type: String, default: '40%' },
    closeOnClickModal: { type: Boolean, default: false },
    destroyOnClose: { type: Boolean, default: true },
    showFooter: { type: Boolean, default: true }
  })
  defineEmits(['update:modelValue', 'ok', 'cancel'])
</script>
